package com.sky.mapper.user;

import com.sky.pojo.ShoppingCart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    List<ShoppingCart> list(ShoppingCart shoppingCart);

    void updateNumberById(ShoppingCart shoppingCart);

    void insert(ShoppingCart shoppingCart);

    List<ShoppingCart> selectByUserId(Long currentId);

    void deleteByUserId(Long currentId);

    void deleteById(Long id, Long userId);

    // 在 ShoppingCartMapper 接口中需要添加：
    @Select("SELECT * FROM shopping_cart WHERE user_id = #{userId}")
    ShoppingCart getById( @Param("userId") Long userId);

}
